****APPENDIX FIGURE B6-B9****

cd "$main_dir/output/figures/appendix_b"

graph set window fontface "Palatino"

//--------------------------------------------------------
//Create Figure B6
//--------------------------------------------------------
clear
use "$data_dir/clean/country_year_panel.dta"

xtset panelid year

keep if region=="Europe" & year>=2006 & year<=2022
drop if ccode=="XKX" | ccode=="AND"

xtline trust_govt_wo, addplot(line growth_rate year, lcolor(maroon) yaxis(2)) ///
	i(ccode) t(year) lcolor(navy) plotregion(lcolor(black)) ///
	ytitle("Trust in Government", size(small)) ///
	xtitle("Year", size(small)) ///
	subtitle(, box lcolor(black)) ///
	legend(label (1 "Trust in Government") label (2 "Growth Rate")) legend(size(vsmall)) ///
	ylabel(, labsize(medium)) xlabel(, labsize(medium)) byopt(graphregion(color(white)) bgcolor(white) r1(Growth Rate, size(small) orientation(rvertical)) title("Europe", size(medium) color(black)) note("") cols(6))
graph export "figure_b6.png", replace

//--------------------------------------------------------
//Create Figure B7
//--------------------------------------------------------
clear
use "$data_dir/clean/country_year_panel.dta"

xtset panelid year

keep if region=="Americas" & year>=2006 & year<=2022
drop if ccode=="BLZ" | ccode=="CUB" | ccode=="GUY" | ccode=="SUR" | ccode=="BHS" | ccode=="DMA" | ccode=="GRD" | ccode=="LCA"

xtline trust_govt_wo, addplot(line growth_rate year, lcolor(maroon) yaxis(2)) ///
	i(ccode) t(year) lcolor(navy) plotregion(lcolor(black)) ///
	ytitle("Trust in Government", size(small)) ///
	xtitle("Year", size(small)) ///
	subtitle(, box lcolor(black)) ///
	legend(label (1 "Trust in Government") label (2 "Growth Rate")) legend(size(vsmall)) ///
	ylabel(, labsize(medium)) xlabel(, labsize(medium)) byopt(graphregion(color(white)) bgcolor(white) r1(Growth Rate, size(small) orientation(rvertical)) title("Americas", size(medium) color(black)) note("") cols(6))
graph export "figure_b7.png", replace

//--------------------------------------------------------
//Create Figure B8
//--------------------------------------------------------
clear
use "$data_dir/clean/country_year_panel.dta"

xtset panelid year

keep if region=="Africa" & year>=2006 & year<=2022
drop if ccode=="BDI" | ccode=="CPV" | ccode=="DJI" | ccode=="GMB" | ccode=="SOM" | ccode=="SSD" | ccode=="STP" | ccode=="SWZ" | ccode=="LBY" | ccode=="CAF"

xtline trust_govt_wo, addplot(line growth_rate year, lcolor(maroon) yaxis(2)) ///
	i(ccode) t(year) lcolor(navy) plotregion(lcolor(black)) ///
	ytitle("Trust in Government", size(small)) ///
	xtitle("Year", size(small)) ///
	subtitle(, box lcolor(black)) ///
	legend(label (1 "Trust in Government") label (2 "Growth Rate")) legend(size(vsmall)) ///
	ylabel(, labsize(medium)) xlabel(, labsize(medium)) byopt(graphregion(color(white)) bgcolor(white) r1(Growth Rate, size(small) orientation(rvertical)) title("Africa", size(medium) color(black)) note("") cols(6))
graph export "figure_b8.png", replace
	
//--------------------------------------------------------
//Create Figure B9
//--------------------------------------------------------
clear
use "$data_dir/clean/country_year_panel.dta"

xtset panelid year

keep if (region=="Asia" | region=="Oceaia") & year>=2006 & year<=2022
drop if ccode=="MMR" | ccode=="BTN" | ccode=="TKM" | ccode=="ARE" | ccode=="BHR" | ccode=="LBY" | ccode=="OMN" | ccode=="QAT" | ccode=="SAU" | ccode=="SYR"| ccode=="KWT" | ccode=="MDV" | ccode=="MAC"

xtline trust_govt_wo, addplot(line growth_rate year, lcolor(maroon) yaxis(2)) ///
	i(ccode) t(year) lcolor(navy) plotregion(lcolor(black)) ///
	ytitle("Trust in Government", size(small)) ///
	xtitle("Year", size(small)) ///
	subtitle(, box lcolor(black)) ///
	legend(label (1 "Trust in Government") label (2 "Growth Rate")) legend(size(vsmall)) ///
	ylabel(, labsize(medium)) xlabel(, labsize(medium)) byopt(graphregion(color(white)) bgcolor(white) r1(Growth Rate, size(small) orientation(rvertical)) title("Asia and Oceania", size(medium) color(black)) note("") cols(6))
graph export "figure_b9.png", replace
